home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1997
/
MacHack 1997.toast
/
Hacks
/
Hacks ’96
/
PredatorPrey
/
calc_draw_object.c
< prev
next >
Wrap
Text File
|
1996-06-22
|
90KB
|
2,613 lines
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
/* */
/* Prototype HP15C Calculator */
/* James C. Ullrey */
/* INRESCO */
/* © 1990 */
/* Version 13.97a */
/* */
/* DRAW_OBJECT SEGMENT */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
/*****************************************************************/
/* I N C L U D E S
/*****************************************************************/
#ifndef __C14__
#include "PredatorPrey.h"
#endif
#include "calc_draw_object.h"
//#define noShow
/********************************************************************
/* G L O B A L V A R I A B L E D E C L A R A T I O N S
/********************************************************************/
extern WindowPtr lastPtr;
extern Rect gFirstCalcIcon,gSecondCalcIcon,gThirdCalcIcon;
extern Rect gFourthCalcIcon,gFifthCalcIcon,gSixthCalcIcon;
extern WindowPtr preyPtr;
/********************** draw_object **************************/
void draw_object(WindowPtr wPtr,short n,Boolean spec)
/* n was formerly index */
{
short obj_type,i,j,k,m;
short _left,_top,_right,_bottom;
Handle icon_hndl;
Point offset; /* amount the document has been scrolled */
Rect obj_rect, selector_rect;
PenState pen_state;
WObjsHandle w_objs_hndl;
PolyHandle thePoly;
PolyHandle otherPoly;
PolyHandle thatPoly;
GrafPtr oldPort;
PicHandle gMissle;
long xMPt,yMPt;
// Boolean doPers = FALSE;
Boolean doPers = TRUE;
Boolean noShow = TRUE;
double_t fL,xVan,yVan,negInvrsFL;
double_t zScale;
//double_t pers4Mat[4][4];
//double_t pers8Mat[4][4];
//double_t pers3Mat[4][4];
//double_t newPers4Vect[4][4];
//double_t newPers8Vect[8][4];
//double_t newPers3Vect[8][4];
//double_t preplot4[4][4];
short xFactor,yFactor;
double_t pers4Mat[4][4][4];
double_t pers8Mat[8][4][4];
double_t pers3Mat[3][4][4];
double_t newPers4Vect[4][4];
double_t newPers8Vect[8][4];
double_t newPers3Vect[3][4];
double_t preplot4[4][4];
double_t preplot8[8][4];
double_t preplot3[3][4];
double_t Wtemp4[4];
double_t Wtemp8[8];
double_t Wtemp3[3];
double_t xForm4[4][4];
double_t xForm8[8][4];
double_t xForm3[3][4];
double_t VRPxform[4][4];
/************* Establish the size and location of the object **************/
w_objs_hndl = (WObjsHandle)GetWRefCon(wPtr);
offset = (**w_objs_hndl).scrollAmount;
//if((**w_objs_hndl).paletteSetting != BACKGRND_OBJ)
if(n <= MAX_OBJECTS)
{
obj_rect = (**w_objs_hndl).object[n].bounds;
if(!spec) OffsetRect(&obj_rect, -offset.h, -offset.v);
obj_type = (**w_objs_hndl).object[n].type;
/***** Outline "selected" objects in gray if window is active ******/
if( ((wPtr == FrontWindow()) || (wPtr == lastPtr)) && ((**w_objs_hndl).object[n].selected != NO_OBJ))
{
GetPort(&oldPort );
SetPort(lastPtr);
GetPenState (&pen_state);
PenNormal();
PenSize(2,2);
//PenPat((PatPtr)gray);
PenPat(&qd.gray);
FrameRect (&obj_rect);
/***** Put a small black "grow box" in lower right of framing rectangle ******/
SetRect(&selector_rect,
obj_rect.right - 5,
obj_rect.bottom - 5,
obj_rect.right ,
obj_rect.bottom);
PenPat(&qd.black);
PaintRect(&selector_rect);
SetPenState (&pen_state);
SetPort( oldPort );
}
}
else if(n == MAX_OBJECTS + 2)
{
if((**w_objs_hndl).hasTargets == TRUE) obj_type = T_BACKGRND_OBJ;
else obj_type = BACKGRND_OBJ;
}
/************* Draw the object **************/
GetPort(&oldPort );
if((**w_objs_hndl).isPrey)
{
SetPort(preyPtr);
}
else SetPort(lastPtr);
if(obj_type == CIRCLE_OBJ) FrameOval(&obj_rect);
else if(obj_type == SQUARE_OBJ) FrameRect(&obj_rect);
else if(obj_type == CUBE_OBJ)
{
thePoly = OpenPoly();
MoveTo((**w_objs_hndl).object[n]._3dPt[0].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[0].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[1].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[1].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[2].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[2].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[3].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[3].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[0].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[0].y_point -offset.v);
ClosePoly();
FillPoly( thePoly,&qd.black);
LineTo((**w_objs_hndl).object[n]._3dPt[4].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[4].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[5].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[5].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[6].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[6].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[7].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[7].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[4].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[4].y_point -offset.v);
MoveTo((**w_objs_hndl).object[n]._3dPt[1].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[1].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[5].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[5].y_point -offset.v);
MoveTo((**w_objs_hndl).object[n]._3dPt[2].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[2].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[6].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[6].y_point -offset.v);
MoveTo((**w_objs_hndl).object[n]._3dPt[3].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[3].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[7].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[7].y_point -offset.v);
}
else if(obj_type == HOUSE_OBJ /*|| obj_type == ARMD_HOUSE3_OBJ || obj_type == ARMD_HOUSE2_OBJ || obj_type == ARMD_HOUSE1_OBJ*/ )
{
MoveTo((**w_objs_hndl).object[n]._3dPt[0].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[0].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[1].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[1].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[2].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[2].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[3].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[3].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[4].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[4].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[0].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[0].y_point -offset.v);
MoveTo((**w_objs_hndl).object[n]._3dPt[5].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[5].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[6].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[6].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[7].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[7].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[8].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[8].y_point -offset.v);
MoveTo((**w_objs_hndl).object[n]._3dPt[0].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[0].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[9].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[9].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[10].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[10].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[11].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[11].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[12].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[12].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[13].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[13].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[9].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[9].y_point -offset.v);
MoveTo((**w_objs_hndl).object[n]._3dPt[1].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[1].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[10].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[10].y_point -offset.v);
MoveTo((**w_objs_hndl).object[n]._3dPt[2].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[2].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[11].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[11].y_point -offset.v);
MoveTo((**w_objs_hndl).object[n]._3dPt[3].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[3].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[12].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[12].y_point -offset.v);
MoveTo((**w_objs_hndl).object[n]._3dPt[4].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[4].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[13].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[13].y_point -offset.v);
MoveTo((**w_objs_hndl).object[n]._3dPt[14].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[14].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[15].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[15].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[16].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[16].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[17].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[17].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[14].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[14].y_point -offset.v);
if((**w_objs_hndl).object[n].armed == TRUE)
{
MoveTo((**w_objs_hndl).object[n]._3dPt[18].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[18].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[19].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[19].y_point -offset.v);
MoveTo((**w_objs_hndl).object[n]._3dPt[20].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[20].y_point -offset.v);
LineTo((**w_objs_hndl).object[n]._3dPt[21].x_point -offset.h,
(**w_objs_hndl).object[n]._3dPt[21].y_point -offset.v);
if((**w_objs_hndl).armament_type >= 1 && (**w_objs_hndl).isPrey != 1)
{
gMissle = GetPicture( 130 );
xMPt = (**w_objs_hndl).object[n]._3dPt[0].x_point -offset.h;
yMPt = (**w_objs_hndl).object[n]._3dPt[0].y_point -offset.v;
SetRect(&(**w_objs_hndl).object[n].mStruct[0].mRect,xMPt-13,yMPt-12,xMPt-1,yMPt);
SetRect(&(**w_objs_hndl).object[n].mStruct[1].mRect,xMPt+81,yMPt-12,xMPt+93,yMPt);
SetRect(&(**w_objs_hndl).object[n].mStruct[2].mRect,xMPt-13,yMPt-26,xMPt-1,yMPt-14);
SetRect(&(**w_objs_hndl).object[n].mStruct[3].mRect,xMPt+81,yMPt-26,xMPt+93,yMPt-14);
SetRect(&(**w_objs_hndl).object[n].mStruct[4].mRect,xMPt-13,yMPt-40,xMPt-1,yMPt-28);
SetRect(&(**w_objs_hndl).object[n].mStruct[5].mRect,xMPt+81,yMPt-40,xMPt+93,yMPt-28);
SetRect(&(**w_objs_hndl).object[n].mStruct[6].mRect,xMPt-13,yMPt-54,xMPt-1,yMPt-42);
SetRect(&(**w_objs_hndl).object[n].mStruct[7].mRect,xMPt+81,yMPt-54,xMPt+93,yMPt-42);
SetRect(&(**w_objs_hndl).object[n].mStruct[8].mRect,xMPt-1,yMPt+1,xMPt+11,yMPt+13);
SetRect(&(**w_objs_hndl).object[n].mStruct[9].mRect,xMPt+69,yMPt+1,xMPt+81,yMPt+13);
SetRect(&(**w_objs_hndl).object[n].mStruct[10].mRect,xMPt+13,yMPt+1,xMPt+25,yMPt+13);
SetRect(&(**w_objs_hndl).object[n].mStruct[11].mRect,xMPt+55,yMPt+1,xMPt+67,yMPt+13);
SetRect(&(**w_objs_hndl).object[n].mStruct[12].mRect,xMPt+27,yMPt+1,xMPt+39,yMPt+13);
SetRect(&(**w_objs_hndl).object[n].mStruct[13].mRect,xMPt+41,yMPt+1,xMPt+53,yMPt+13);
for(i = 14 - (**w_objs_hndl).object[n].missles;i <= 13;i++)
{
DrawPicture(gMissle,&(**w_objs_hndl).object[n].mStruct[i].mRect);
}
}
}
}
else if(obj_type == BACKGRND_OBJ || obj_type == T_BACKGRND_OBJ)
{
fL = (**w_objs_hndl).focalLn;
negInvrsFL = fL;
xVan = (**w_objs_hndl).xvPt;
yVan = (**w_objs_hndl).yvPt;
/* initialize VRPxform */
for(i = 0;i <= 3;i++)
{
for(j = 0;j <= 3;j++)
{
if (i == j)
VRPxform[i][j] = 1;
else
VRPxform[i][j] = 0;
}
}
/* set zScale */
zScale = 200.0;
/* set VRP */
VRPxform[0][3] = -1.0 * xVan;
VRPxform[1][3] = -1.0 * yVan;
if( (**w_objs_hndl).bg_object[0]._3dPt_BG[0].z_point < 0 &&
(**w_objs_hndl).bg_object[0]._3dPt_BG[1].z_point < 0 &&
(**w_objs_hndl).bg_object[0]._3dPt_BG[2].z_point < 0 &&
(**w_objs_hndl).bg_object[0]._3dPt_BG[3].z_point < 0)
{
if(doPers) /* first tetrahedron */
{
for(j = 0;j <= 3;j++) /* 0••3 cause 4 points in a tetrahedron */
{
preplot4[j][0] = (**w_objs_hndl).bg_object[0]._3dPt_BG[j].x_point -offset.h;
preplot4[j][1] = (**w_objs_hndl).bg_object[0]._3dPt_BG[j].y_point -offset.v;
preplot4[j][2] = (**w_objs_hndl).bg_object[0]._3dPt_BG[j].z_point;
preplot4[j][3] = (**w_objs_hndl).bg_object[0]._3dPt_BG[j].no_point;
} /* got coords for all four points in this obj */
/* transform to relative VRP */
for(j = 0;j <= 4;j++)
{
for(k = 0;k <= 3;k++)
{
xForm4[j][k] = 0.0;
}
}
for(j = 0;j <= 4;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm4[j][k] += VRPxform[k][i] * preplot4[j][i];
}
}
}
/* first create and initialize persMat */
for(j = 0;j <= 3;j++)
{
for(k = 0;k <= 3;k++)
{
for(m = 0;m <= 3;m++)
{
if(m == k) pers4Mat[j][k][m] = 1;
else pers4Mat[j][k][m] = 0;
}
}
}
for(j = 0;j <= 3;j++) /* cause four vertices in the object */
{
Wtemp4[j] = (xForm4[j][2]) / zScale; /* tenth try */
}
for(m = 0;m <= 3;m++)
{
for(k = 0;k <= 2;k++)
{
newPers4Vect[m][k] = 0; /* initialize */
}
newPers4Vect[m][3] = 1;
}
for(m = 0;m <= 3;m++)
{ /* *---------------- vertice point */
/* | *----------- row */
for(k = 0;k <= 2;k++) /* | | *-------- column */
{ /* v v v */
newPers4Vect[m][k] = xForm4[m][k]/(Wtemp4[m]);
}
}
/* transform back from VRP */
VRPxform[0][3] = xVan;
VRPxform[1][3] = yVan;
for(j = 0;j <= 3;j++)
{
for(k = 0;k <= 3;k++)
{
xForm4[j][k] = 0;
}
}
for(j = 0;j <= 3;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm4[j][k] += VRPxform[k][i] * newPers4Vect[j][i];
}
}
}
for(j = 0;j <= 3;j++)
{
for(k = 0;k <= 3;k++)
{
newPers4Vect[j][k] = xForm4[j][k];
}
}
thePoly = OpenPoly();
MoveTo(newPers4Vect[0][0],newPers4Vect[0][1]); /* first tetrahedron */
LineTo(newPers4Vect[1][0],newPers4Vect[1][1]);
LineTo(newPers4Vect[2][0],newPers4Vect[2][1]);
LineTo(newPers4Vect[0][0],newPers4Vect[0][1]);
ClosePoly();
FillPoly( thePoly,&qd.black);
LineTo(newPers4Vect[3][0],newPers4Vect[3][1]);
LineTo(newPers4Vect[1][0],newPers4Vect[1][1]);
MoveTo(newPers4Vect[2][0],newPers4Vect[2][1]);
LineTo(newPers4Vect[3][0],newPers4Vect[3][1]);
}
else // if (!noShow)
{
MoveTo((**w_objs_hndl).bg_object[0]._3dPt_BG[0].x_point -offset.h, /* first tetrahedron */
(**w_objs_hndl).bg_object[0]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[0]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[0]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[0]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[0]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[0]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[0]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[0]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[0]._3dPt_BG[3].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[0]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[0]._3dPt_BG[1].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[0]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[0]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[0]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[0]._3dPt_BG[3].y_point -offset.v);
}
}
if( (**w_objs_hndl).bg_object[1]._3dPt_BG[0].z_point < 0 &&
(**w_objs_hndl).bg_object[1]._3dPt_BG[1].z_point < 0 &&
(**w_objs_hndl).bg_object[1]._3dPt_BG[2].z_point < 0 &&
(**w_objs_hndl).bg_object[1]._3dPt_BG[3].z_point < 0)
{
if(doPers) /* second tetrahedron */
{
for(j = 0;j <= 3;j++) /* 0••3 cause 4 points in a tetrahedron */
{
preplot4[j][0] = (**w_objs_hndl).bg_object[1]._3dPt_BG[j].x_point -offset.h;
preplot4[j][1] = (**w_objs_hndl).bg_object[1]._3dPt_BG[j].y_point -offset.v;
preplot4[j][2] = (**w_objs_hndl).bg_object[1]._3dPt_BG[j].z_point;
preplot4[j][3] = (**w_objs_hndl).bg_object[1]._3dPt_BG[j].no_point;
}
/* transform to relative VRP */
for(j = 0;j <= 3;j++) /* initialize xForm4 */
{
for(k = 0;k <= 3;k++)
{
xForm4[j][k] = 0.0;
}
}
/* set VRP */
VRPxform[0][3] = -1.0 * xVan;
VRPxform[1][3] = -1.0 * yVan;
for(j = 0;j <= 3;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm4[j][k] += VRPxform[k][i] * preplot4[j][i];
}
}
} /* first create persMat */
for(j = 0;j <= 3;j++)
{
for(k = 0;k <= 3;k++)
{
for(m = 0;m <= 3;m++)
{
if(m == k) pers4Mat[j][k][m] = 1;
else pers4Mat[j][k][m] = 0;
}
}
}
for(j = 0;j <= 3;j++) /* cause four vertices in the object */
{
Wtemp4[j] = (xForm4[j][2]) / zScale; /* tenth try */
}
for(m = 0;m <= 3;m++)
{
for(k = 0;k <= 2;k++)
{
newPers4Vect[m][k] = 0;
}
newPers4Vect[m][3] = 1;
}
for(m = 0;m <= 3;m++) /* *-------------- vertice point */
{ /* | *----------- column */
for(k = 0;k <= 2;k++) /* | | *-------- vertice point */
{ /* v v v */
newPers4Vect[m][k] = xForm4[m][k]/(Wtemp4[m]);
}
}
/* transform back from VRP */
VRPxform[0][3] = xVan;
VRPxform[1][3] = yVan;
for(j = 0;j <= 3;j++)
{
for(k = 0;k <= 3;k++)
{
xForm4[j][k] = 0;
}
}
for(j = 0;j <= 3;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm4[j][k] += VRPxform[k][i] * newPers4Vect[j][i];
}
}
}
for(j = 0;j <= 3;j++)
{
for(k = 0;k <= 3;k++)
{
newPers4Vect[j][k] = xForm4[j][k];
}
}
MoveTo(newPers4Vect[0][0],newPers4Vect[0][1]); /* second tetrahedron */
LineTo(newPers4Vect[1][0],newPers4Vect[1][1]);
LineTo(newPers4Vect[2][0],newPers4Vect[2][1]);
thePoly = OpenPoly();
LineTo(newPers4Vect[0][0],newPers4Vect[0][1]);
LineTo(newPers4Vect[3][0],newPers4Vect[3][1]);
LineTo(newPers4Vect[2][0],newPers4Vect[2][1]);
ClosePoly();
FillPoly( thePoly,&qd.gray);
MoveTo(newPers4Vect[1][0],newPers4Vect[1][1]);
LineTo(newPers4Vect[3][0],newPers4Vect[3][1]);
}
else // if (!noShow)
{
MoveTo((**w_objs_hndl).bg_object[1]._3dPt_BG[0].x_point -offset.h, /* second tetrahedron */
(**w_objs_hndl).bg_object[1]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[1]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[1]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[1]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[1]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[1]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[1]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[1]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[1]._3dPt_BG[3].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[1]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[1]._3dPt_BG[1].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[1]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[1]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[1]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[1]._3dPt_BG[3].y_point -offset.v);
}
}
if( (**w_objs_hndl).bg_object[2]._3dPt_BG[0].z_point < 0 &&
(**w_objs_hndl).bg_object[2]._3dPt_BG[1].z_point < 0 &&
(**w_objs_hndl).bg_object[2]._3dPt_BG[2].z_point < 0 &&
(**w_objs_hndl).bg_object[2]._3dPt_BG[3].z_point < 0)
{
if(doPers)
{
for(j = 0;j <= 3;j++) /* 0••3 cause 4 points in a tetrahedron */
{
preplot4[j][0] = (**w_objs_hndl).bg_object[2]._3dPt_BG[j].x_point -offset.h;
preplot4[j][1] = (**w_objs_hndl).bg_object[2]._3dPt_BG[j].y_point -offset.v;
preplot4[j][2] = (**w_objs_hndl).bg_object[2]._3dPt_BG[j].z_point;
preplot4[j][3] = (**w_objs_hndl).bg_object[2]._3dPt_BG[j].no_point;
}
/* transform to relative VRP */
for(j = 0;j <= 3;j++) /* initialize xForm4 */
{
for(k = 0;k <= 3;k++)
{
xForm4[j][k] = 0.0;
}
}
/* set VRP */
VRPxform[0][3] = -1.0 * xVan;
VRPxform[1][3] = -1.0 * yVan;
for(j = 0;j <= 3;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm4[j][k] += VRPxform[k][i] * preplot4[j][i];
}
}
} /* first create persMat */
for(j = 0;j <= 3;j++)
{
for(k = 0;k <= 3;k++)
{
for(m = 0;m <= 3;m++)
{
if(m == k) pers4Mat[j][k][m] = 1;
else pers4Mat[j][k][m] = 0;
}
}
}
for(j = 0;j <= 3;j++) /* cause four vertices in the object */
{
Wtemp4[j] = (xForm4[j][2]) / zScale; /* tenth try */
}
for(m = 0;m <= 3;m++)
{
for(k = 0;k <= 2;k++)
{
newPers4Vect[m][k] = 0;
}
newPers4Vect[m][3] = 1;
}
for(m = 0;m <= 3;m++) /* *-------------- vertice point */
{ /* | *----------- column */
for(k = 0;k <= 2;k++) /* | | *-------- vertice point */
{ /* v v v */
newPers4Vect[m][k] = xForm4[m][k]/(Wtemp4[m]);
}
}
/* transform back from VRP */
VRPxform[0][3] = xVan;
VRPxform[1][3] = yVan;
for(j = 0;j <= 3;j++)
{
for(k = 0;k <= 3;k++)
{
xForm4[j][k] = 0;
}
}
for(j = 0;j <= 3;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm4[j][k] += VRPxform[k][i] * newPers4Vect[j][i];
}
}
}
for(j = 0;j <= 3;j++)
{
for(k = 0;k <= 3;k++)
{
newPers4Vect[j][k] = xForm4[j][k];
}
}
MoveTo(newPers4Vect[0][0],newPers4Vect[0][1]); /* third tetrahedron */
LineTo(newPers4Vect[1][0],newPers4Vect[1][1]);
thePoly = OpenPoly();
LineTo(newPers4Vect[2][0],newPers4Vect[2][1]);
LineTo(newPers4Vect[3][0],newPers4Vect[3][1]);
LineTo(newPers4Vect[1][0],newPers4Vect[1][1]);
ClosePoly();
FillPoly( thePoly,&qd.gray);
LineTo(newPers4Vect[1][0],newPers4Vect[1][1]);
MoveTo(newPers4Vect[2][0],newPers4Vect[2][1]);
LineTo(newPers4Vect[0][0],newPers4Vect[0][1]);
LineTo(newPers4Vect[3][0],newPers4Vect[3][1]);
}
else // if (!noShow)
{
MoveTo((**w_objs_hndl).bg_object[2]._3dPt_BG[0].x_point -offset.h, /* third tetrahedron */
(**w_objs_hndl).bg_object[2]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[2]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[2]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[2]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[2]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[2]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[2]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[2]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[2]._3dPt_BG[3].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[2]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[2]._3dPt_BG[1].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[2]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[2]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[2]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[2]._3dPt_BG[3].y_point -offset.v);
}
}
if( (**w_objs_hndl).bg_object[3]._3dPt_BG[0].z_point < 0 &&
(**w_objs_hndl).bg_object[3]._3dPt_BG[1].z_point < 0 &&
(**w_objs_hndl).bg_object[3]._3dPt_BG[2].z_point < 0 &&
(**w_objs_hndl).bg_object[3]._3dPt_BG[3].z_point < 0 &&
(**w_objs_hndl).bg_object[3]._3dPt_BG[4].z_point < 0 &&
(**w_objs_hndl).bg_object[3]._3dPt_BG[5].z_point < 0 &&
(**w_objs_hndl).bg_object[3]._3dPt_BG[6].z_point < 0 &&
(**w_objs_hndl).bg_object[3]._3dPt_BG[7].z_point < 0)
{
if(doPers) /* first column */
{
for(j = 0;j <= 7;j++) /* 0••7 cause 8 points in a cube or column */
{
//960620
preplot8[j][0] = (**w_objs_hndl).bg_object[3]._3dPt_BG[j].x_point -offset.h;
preplot8[j][1] = (**w_objs_hndl).bg_object[3]._3dPt_BG[j].y_point -offset.v;
preplot8[j][2] = (**w_objs_hndl).bg_object[3]._3dPt_BG[j].z_point;
preplot8[j][3] = (**w_objs_hndl).bg_object[3]._3dPt_BG[j].no_point;
}
/* transform to relative VRP */
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
xForm8[j][k] = 0.0;
}
}
VRPxform[0][3] = -1.0 * xVan;
VRPxform[1][3] = -1.0 * yVan;
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm8[j][k] += VRPxform[k][i] * preplot8[j][i];
}
}
}
/* first create and initialize persMat */
for(j = 0;j <= 7;j++) /* Create the translation matrices */
{
for(k = 0;k <= 3;k++)
{
for(m = 0;m <= 3;m++)
{
if(m == k) pers8Mat[j][k][m] = 1;
else pers8Mat[j][k][m] = 0;
}
}
}
for(j = 0;j <= 7;j++) /* cause eight vertices in the object */
{
Wtemp8[j] = (xForm8[j][2]) / zScale; /* tenth try */
}
for(m = 0;m <= 7;m++)
{
for(k = 0;k <= 2;k++)
{
newPers8Vect[m][k] = 0;
}
newPers8Vect[m][3] = 1;
}
for(m = 0;m <= 7;m++) // which vertex
{
/* *---------------- vertice point */
/* | *------------- row */
for(k = 0;k <= 2;k++) /* | | *-- vertice point */
{ /* v v v */
newPers8Vect[m][k] = xForm8[m][k]/(Wtemp8[m]);
}
}
/* transform back from VRP */
VRPxform[0][3] = xVan;
VRPxform[1][3] = yVan;
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
xForm8[j][k] = 0;
}
}
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm8[j][k] += VRPxform[k][i] * newPers8Vect[j][i];
}
}
}
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
newPers8Vect[j][k] = xForm8[j][k];
}
}
MoveTo(newPers8Vect[0][0],newPers8Vect[0][1]); /* first column */
thePoly = OpenPoly();
LineTo(newPers8Vect[1][0],newPers8Vect[1][1]);
LineTo(newPers8Vect[2][0],newPers8Vect[2][1]);
LineTo(newPers8Vect[3][0],newPers8Vect[3][1]);
LineTo(newPers8Vect[0][0],newPers8Vect[0][1]);
ClosePoly();
FillPoly( thePoly,&qd.black);
LineTo(newPers8Vect[4][0],newPers8Vect[4][1]);
thePoly = OpenPoly();
LineTo(newPers8Vect[5][0],newPers8Vect[5][1]);
LineTo(newPers8Vect[6][0],newPers8Vect[6][1]);
LineTo(newPers8Vect[7][0],newPers8Vect[7][1]);
LineTo(newPers8Vect[4][0],newPers8Vect[4][1]);
ClosePoly();
FillPoly( thePoly,&qd.gray);
MoveTo(newPers8Vect[1][0],newPers8Vect[1][1]);
LineTo(newPers8Vect[5][0],newPers8Vect[5][1]);
MoveTo(newPers8Vect[2][0],newPers8Vect[2][1]);
LineTo(newPers8Vect[6][0],newPers8Vect[6][1]);
MoveTo(newPers8Vect[3][0],newPers8Vect[3][1]);
LineTo(newPers8Vect[7][0],newPers8Vect[7][1]);
}
else // if (!noShow) /*if(!debugPers)*/
{
MoveTo((**w_objs_hndl).bg_object[3]._3dPt_BG[0].x_point -offset.h, /* first column */
(**w_objs_hndl).bg_object[3]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[3]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[3]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[3]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[3]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[3]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[3]._3dPt_BG[3].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[3]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[3]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[3]._3dPt_BG[4].x_point -offset.h,
(**w_objs_hndl).bg_object[3]._3dPt_BG[4].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[3]._3dPt_BG[5].x_point -offset.h,
(**w_objs_hndl).bg_object[3]._3dPt_BG[5].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[3]._3dPt_BG[6].x_point -offset.h,
(**w_objs_hndl).bg_object[3]._3dPt_BG[6].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[3]._3dPt_BG[7].x_point -offset.h,
(**w_objs_hndl).bg_object[3]._3dPt_BG[7].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[3]._3dPt_BG[4].x_point -offset.h,
(**w_objs_hndl).bg_object[3]._3dPt_BG[4].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[3]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[3]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[3]._3dPt_BG[5].x_point -offset.h,
(**w_objs_hndl).bg_object[3]._3dPt_BG[5].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[3]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[3]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[3]._3dPt_BG[6].x_point -offset.h,
(**w_objs_hndl).bg_object[3]._3dPt_BG[6].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[3]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[3]._3dPt_BG[3].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[3]._3dPt_BG[7].x_point -offset.h,
(**w_objs_hndl).bg_object[3]._3dPt_BG[7].y_point -offset.v);
}
}
if( (**w_objs_hndl).bg_object[4]._3dPt_BG[0].z_point < 0 &&
(**w_objs_hndl).bg_object[4]._3dPt_BG[1].z_point < 0 &&
(**w_objs_hndl).bg_object[4]._3dPt_BG[2].z_point < 0 &&
(**w_objs_hndl).bg_object[4]._3dPt_BG[3].z_point < 0 &&
(**w_objs_hndl).bg_object[4]._3dPt_BG[4].z_point < 0 &&
(**w_objs_hndl).bg_object[4]._3dPt_BG[5].z_point < 0 &&
(**w_objs_hndl).bg_object[4]._3dPt_BG[6].z_point < 0 &&
(**w_objs_hndl).bg_object[4]._3dPt_BG[7].z_point < 0)
{
if(doPers) // && (**w_objs_hndl).isPrey) /* work area */
{
for(j = 0;j <= 7;j++) /* j is point in the object */
{ /* 0••7 cause 8 points in a cube or column */ /* Use convenient local variable */
preplot8[j][0] = (**w_objs_hndl).bg_object[4]._3dPt_BG[j].x_point -offset.h; /* */
preplot8[j][1] = (**w_objs_hndl).bg_object[4]._3dPt_BG[j].y_point -offset.v; /* */
preplot8[j][2] = (**w_objs_hndl).bg_object[4]._3dPt_BG[j].z_point; /* */
preplot8[j][3] = (**w_objs_hndl).bg_object[4]._3dPt_BG[j].no_point; /* */
}
/* transform to relative VRP */
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
xForm8[j][k] = 0.0;
}
}
VRPxform[0][3] = -1.0 * xVan;
VRPxform[1][3] = -1.0 * yVan;
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm8[j][k] += VRPxform[k][i] * preplot8[j][i];
}
}
}
/* first create and initialize persMat */
for(j = 0;j <= 7;j++) /* Create the translation matrices */
{
for(k = 0;k <= 3;k++)
{
for(m = 0;m <= 3;m++)
{
if(m == k) pers8Mat[j][k][m] = 1;
else pers8Mat[j][k][m] = 0;
}
}
}
for(j = 0;j <= 7;j++) /* cause eight vertices in the object */
{
Wtemp8[j] = (xForm8[j][2]) / zScale; /* tenth try */
}
for(m = 0;m <= 7;m++)
{
for(k = 0;k <= 2;k++)
{
newPers8Vect[m][k] = 0;
}
newPers8Vect[m][3] = 1;
}
for(m = 0;m <= 7;m++) // which vertex
{
/* *---------------- vertice point */
/* | *------------- row */
for(k = 0;k <= 2;k++) /* | | *--- vertice point */
{ /* v v v */
newPers8Vect[m][k] = xForm8[m][k]/(Wtemp8[m]);
}
}
/* transform back from VRP */
VRPxform[0][3] = xVan;
VRPxform[1][3] = yVan;
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
xForm8[j][k] = 0;
}
}
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm8[j][k] += VRPxform[k][i] * newPers8Vect[j][i];
}
}
}
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
newPers8Vect[j][k] = xForm8[j][k];
}
}
//DebugStr("\pThis is a fucking test");
MoveTo(newPers8Vect[0][0],newPers8Vect[0][1]); /* second column */
thePoly = OpenPoly();
LineTo(newPers8Vect[1][0],newPers8Vect[1][1]);
LineTo(newPers8Vect[2][0],newPers8Vect[2][1]);
LineTo(newPers8Vect[3][0],newPers8Vect[3][1]);
LineTo(newPers8Vect[0][0],newPers8Vect[0][1]);
ClosePoly();
FillPoly( thePoly,&qd.gray);
LineTo(newPers8Vect[4][0],newPers8Vect[4][1]);
thePoly = OpenPoly();
LineTo(newPers8Vect[5][0],newPers8Vect[5][1]);
LineTo(newPers8Vect[6][0],newPers8Vect[6][1]);
LineTo(newPers8Vect[7][0],newPers8Vect[7][1]);
LineTo(newPers8Vect[4][0],newPers8Vect[4][1]);
ClosePoly();
FillPoly( thePoly,&qd.gray);
MoveTo(newPers8Vect[1][0],newPers8Vect[1][1]);
LineTo(newPers8Vect[5][0],newPers8Vect[5][1]);
MoveTo(newPers8Vect[2][0],newPers8Vect[2][1]);
LineTo(newPers8Vect[6][0],newPers8Vect[6][1]);
MoveTo(newPers8Vect[3][0],newPers8Vect[3][1]);
LineTo(newPers8Vect[7][0],newPers8Vect[7][1]);
}
//else if (!noShow)
else // if (noShow)
{
//DebugStr("\pThis is a test");
MoveTo((**w_objs_hndl).bg_object[4]._3dPt_BG[0].x_point -offset.h, /* second column */
(**w_objs_hndl).bg_object[4]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[4]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[4]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[4]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[4]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[4]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[4]._3dPt_BG[3].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[4]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[4]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[4]._3dPt_BG[4].x_point -offset.h,
(**w_objs_hndl).bg_object[4]._3dPt_BG[4].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[4]._3dPt_BG[5].x_point -offset.h,
(**w_objs_hndl).bg_object[4]._3dPt_BG[5].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[4]._3dPt_BG[6].x_point -offset.h,
(**w_objs_hndl).bg_object[4]._3dPt_BG[6].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[4]._3dPt_BG[7].x_point -offset.h,
(**w_objs_hndl).bg_object[4]._3dPt_BG[7].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[4]._3dPt_BG[4].x_point -offset.h,
(**w_objs_hndl).bg_object[4]._3dPt_BG[4].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[4]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[4]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[4]._3dPt_BG[5].x_point -offset.h,
(**w_objs_hndl).bg_object[4]._3dPt_BG[5].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[4]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[4]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[4]._3dPt_BG[6].x_point -offset.h,
(**w_objs_hndl).bg_object[4]._3dPt_BG[6].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[4]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[4]._3dPt_BG[3].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[4]._3dPt_BG[7].x_point -offset.h,
(**w_objs_hndl).bg_object[4]._3dPt_BG[7].y_point -offset.v);
}
}
if( (**w_objs_hndl).bg_object[5]._3dPt_BG[0].z_point < 0 &&
(**w_objs_hndl).bg_object[5]._3dPt_BG[1].z_point < 0 &&
(**w_objs_hndl).bg_object[5]._3dPt_BG[2].z_point < 0 &&
(**w_objs_hndl).bg_object[5]._3dPt_BG[3].z_point < 0 &&
(**w_objs_hndl).bg_object[5]._3dPt_BG[4].z_point < 0 &&
(**w_objs_hndl).bg_object[5]._3dPt_BG[5].z_point < 0 &&
(**w_objs_hndl).bg_object[5]._3dPt_BG[6].z_point < 0 &&
(**w_objs_hndl).bg_object[5]._3dPt_BG[7].z_point < 0)
{
if(doPers && !debugPers)
{
for(j = 0;j <= 7;j++) /* j is point in the object */
{ /* 0••7 cause 8 points in a cube or column */
preplot8[j][0] = (**w_objs_hndl).bg_object[5]._3dPt_BG[j].x_point -offset.h;
preplot8[j][1] = (**w_objs_hndl).bg_object[5]._3dPt_BG[j].y_point -offset.v;
preplot8[j][2] = (**w_objs_hndl).bg_object[5]._3dPt_BG[j].z_point;
preplot8[j][3] = (**w_objs_hndl).bg_object[5]._3dPt_BG[j].no_point;
}
/* transform to relative VRP */
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
xForm8[j][k] = 0.0;
}
}
VRPxform[0][3] = -1.0 * xVan;
VRPxform[1][3] = -1.0 * yVan;
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm8[j][k] += VRPxform[k][i] * preplot8[j][i];
}
}
}
/* first create and initialize persMat */
for(j = 0;j <= 7;j++) /* Create the translation matrices */
{
for(k = 0;k <= 3;k++)
{
for(m = 0;m <= 3;m++)
{
if(m == k) pers8Mat[j][k][m] = 1;
else pers8Mat[j][k][m] = 0;
}
}
}
for(j = 0;j <= 7;j++) /* cause eight vertices in the object */
{
Wtemp8[j] = (xForm8[j][2]) / zScale; /* tenth try */
}
for(m = 0;m <= 7;m++)
{
for(k = 0;k <= 2;k++)
{
newPers8Vect[m][k] = 0;
}
newPers8Vect[m][3] = 1;
}
for(m = 0;m <= 7;m++) // which vertex
{
/* *---------------- vertice point */
/* | *------------- row */
for(k = 0;k <= 2;k++) /* | | *-- vertice point */
{ /* v v v */
newPers8Vect[m][k] = xForm8[m][k]/(Wtemp8[m]);
}
}
/* transform back from VRP */
VRPxform[0][3] = xVan;
VRPxform[1][3] = yVan;
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
xForm8[j][k] = 0;
}
}
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm8[j][k] += VRPxform[k][i] * newPers8Vect[j][i];
}
}
}
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
newPers8Vect[j][k] = xForm8[j][k];
}
}
MoveTo(newPers8Vect[0][0],newPers8Vect[0][1]); /* third column */
thePoly = OpenPoly();
LineTo(newPers8Vect[1][0],newPers8Vect[1][1]);
LineTo(newPers8Vect[2][0],newPers8Vect[2][1]);
LineTo(newPers8Vect[3][0],newPers8Vect[3][1]);
LineTo(newPers8Vect[0][0],newPers8Vect[0][1]);
ClosePoly();
FillPoly( thePoly,&qd.gray);
LineTo(newPers8Vect[4][0],newPers8Vect[4][1]);
thePoly = OpenPoly();
LineTo(newPers8Vect[5][0],newPers8Vect[5][1]);
LineTo(newPers8Vect[6][0],newPers8Vect[6][1]);
LineTo(newPers8Vect[7][0],newPers8Vect[7][1]);
LineTo(newPers8Vect[4][0],newPers8Vect[4][1]);
ClosePoly();
FillPoly( thePoly,&qd.black);
MoveTo(newPers8Vect[1][0],newPers8Vect[1][1]);
LineTo(newPers8Vect[5][0],newPers8Vect[5][1]);
MoveTo(newPers8Vect[2][0],newPers8Vect[2][1]);
LineTo(newPers8Vect[6][0],newPers8Vect[6][1]);
MoveTo(newPers8Vect[3][0],newPers8Vect[3][1]);
LineTo(newPers8Vect[7][0],newPers8Vect[7][1]);
}
else // if (!noShow) //if(!debugPers)
{
MoveTo((**w_objs_hndl).bg_object[5]._3dPt_BG[0].x_point -offset.h, /* third column */
(**w_objs_hndl).bg_object[5]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[5]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[5]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[5]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[5]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[5]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[5]._3dPt_BG[3].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[5]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[5]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[5]._3dPt_BG[4].x_point -offset.h,
(**w_objs_hndl).bg_object[5]._3dPt_BG[4].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[5]._3dPt_BG[5].x_point -offset.h,
(**w_objs_hndl).bg_object[5]._3dPt_BG[5].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[5]._3dPt_BG[6].x_point -offset.h,
(**w_objs_hndl).bg_object[5]._3dPt_BG[6].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[5]._3dPt_BG[7].x_point -offset.h,
(**w_objs_hndl).bg_object[5]._3dPt_BG[7].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[5]._3dPt_BG[4].x_point -offset.h,
(**w_objs_hndl).bg_object[5]._3dPt_BG[4].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[5]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[5]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[5]._3dPt_BG[5].x_point -offset.h,
(**w_objs_hndl).bg_object[5]._3dPt_BG[5].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[5]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[5]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[5]._3dPt_BG[6].x_point -offset.h,
(**w_objs_hndl).bg_object[5]._3dPt_BG[6].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[5]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[5]._3dPt_BG[3].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[5]._3dPt_BG[7].x_point -offset.h,
(**w_objs_hndl).bg_object[5]._3dPt_BG[7].y_point -offset.v);
}
}
if( (**w_objs_hndl).bg_object[6]._3dPt_BG[0].z_point < 0 &&
(**w_objs_hndl).bg_object[6]._3dPt_BG[1].z_point < 0 &&
(**w_objs_hndl).bg_object[6]._3dPt_BG[2].z_point < 0 &&
(**w_objs_hndl).bg_object[6]._3dPt_BG[3].z_point < 0 &&
(**w_objs_hndl).bg_object[6]._3dPt_BG[4].z_point < 0 &&
(**w_objs_hndl).bg_object[6]._3dPt_BG[5].z_point < 0 &&
(**w_objs_hndl).bg_object[6]._3dPt_BG[6].z_point < 0 &&
(**w_objs_hndl).bg_object[6]._3dPt_BG[7].z_point < 0)
{
if(doPers)
{
for(j = 0;j <= 7;j++) /* j is point in the object */
{ /* 0••7 cause 8 points in a cube or column */
preplot8[j][0] = (**w_objs_hndl).bg_object[6]._3dPt_BG[j].x_point -offset.h;
preplot8[j][1] = (**w_objs_hndl).bg_object[6]._3dPt_BG[j].y_point -offset.v;
preplot8[j][2] = (**w_objs_hndl).bg_object[6]._3dPt_BG[j].z_point;
preplot8[j][3] = (**w_objs_hndl).bg_object[6]._3dPt_BG[j].no_point;
}
/* transform to relative VRP */
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
xForm8[j][k] = 0.0;
}
}
VRPxform[0][3] = -1.0 * xVan;
VRPxform[1][3] = -1.0 * yVan;
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm8[j][k] += VRPxform[k][i] * preplot8[j][i];
}
}
}
/* first create and initialize persMat */
for(j = 0;j <= 7;j++) /* Create the translation matrices */
{
for(k = 0;k <= 3;k++)
{
for(m = 0;m <= 3;m++)
{
if(m == k) pers8Mat[j][k][m] = 1;
else pers8Mat[j][k][m] = 0;
}
}
}
for(j = 0;j <= 7;j++) /* cause eight vertices in the object */
{
Wtemp8[j] = (xForm8[j][2]) / zScale; /* tenth try */
}
for(m = 0;m <= 7;m++)
{
for(k = 0;k <= 2;k++)
{
newPers8Vect[m][k] = 0;
}
newPers8Vect[m][3] = 1;
}
for(m = 0;m <= 7;m++) // which vertex
{
/* *---------------- vertice point */
/* | *------------- row */
for(k = 0;k <= 2;k++) /* | | *-- vertice point */
{ /* v v v */
newPers8Vect[m][k] = xForm8[m][k]/(Wtemp8[m]);
}
}
/* transform back from VRP */
VRPxform[0][3] = xVan;
VRPxform[1][3] = yVan;
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
xForm8[j][k] = 0;
}
}
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm8[j][k] += VRPxform[k][i] * newPers8Vect[j][i];
}
}
}
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
newPers8Vect[j][k] = xForm8[j][k];
}
} /* *-------- column */
MoveTo(newPers8Vect[0][0],newPers8Vect[0][1]); /* first cube */
thePoly = OpenPoly();
LineTo(newPers8Vect[1][0],newPers8Vect[1][1]);
LineTo(newPers8Vect[2][0],newPers8Vect[2][1]);
LineTo(newPers8Vect[3][0],newPers8Vect[3][1]);
LineTo(newPers8Vect[0][0],newPers8Vect[0][1]);
ClosePoly();
FillPoly( thePoly,&qd.gray);
LineTo(newPers8Vect[4][0],newPers8Vect[4][1]);
thePoly = OpenPoly();
LineTo(newPers8Vect[5][0],newPers8Vect[5][1]);
LineTo(newPers8Vect[6][0],newPers8Vect[6][1]);
LineTo(newPers8Vect[7][0],newPers8Vect[7][1]);
LineTo(newPers8Vect[4][0],newPers8Vect[4][1]);
ClosePoly();
FillPoly( thePoly,&qd.black);
MoveTo(newPers8Vect[1][0],newPers8Vect[1][1]);
LineTo(newPers8Vect[5][0],newPers8Vect[5][1]);
MoveTo(newPers8Vect[2][0],newPers8Vect[2][1]);
LineTo(newPers8Vect[6][0],newPers8Vect[6][1]);
MoveTo(newPers8Vect[3][0],newPers8Vect[3][1]);
LineTo(newPers8Vect[7][0],newPers8Vect[7][1]);
}
else // if (!noShow) // if(!debugPers)
{
MoveTo((**w_objs_hndl).bg_object[6]._3dPt_BG[0].x_point -offset.h, /* first cube */
(**w_objs_hndl).bg_object[6]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[6]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[6]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[6]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[6]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[6]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[6]._3dPt_BG[3].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[6]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[6]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[6]._3dPt_BG[4].x_point -offset.h,
(**w_objs_hndl).bg_object[6]._3dPt_BG[4].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[6]._3dPt_BG[5].x_point -offset.h,
(**w_objs_hndl).bg_object[6]._3dPt_BG[5].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[6]._3dPt_BG[6].x_point -offset.h,
(**w_objs_hndl).bg_object[6]._3dPt_BG[6].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[6]._3dPt_BG[7].x_point -offset.h,
(**w_objs_hndl).bg_object[6]._3dPt_BG[7].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[6]._3dPt_BG[4].x_point -offset.h,
(**w_objs_hndl).bg_object[6]._3dPt_BG[4].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[6]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[6]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[6]._3dPt_BG[5].x_point -offset.h,
(**w_objs_hndl).bg_object[6]._3dPt_BG[5].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[6]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[6]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[6]._3dPt_BG[6].x_point -offset.h,
(**w_objs_hndl).bg_object[6]._3dPt_BG[6].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[6]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[6]._3dPt_BG[3].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[6]._3dPt_BG[7].x_point -offset.h,
(**w_objs_hndl).bg_object[6]._3dPt_BG[7].y_point -offset.v);
}
}
if( (**w_objs_hndl).bg_object[7]._3dPt_BG[0].z_point < 0 &&
(**w_objs_hndl).bg_object[7]._3dPt_BG[1].z_point < 0 &&
(**w_objs_hndl).bg_object[7]._3dPt_BG[2].z_point < 0 &&
(**w_objs_hndl).bg_object[7]._3dPt_BG[3].z_point < 0 &&
(**w_objs_hndl).bg_object[7]._3dPt_BG[4].z_point < 0 &&
(**w_objs_hndl).bg_object[7]._3dPt_BG[5].z_point < 0 &&
(**w_objs_hndl).bg_object[7]._3dPt_BG[6].z_point < 0 &&
(**w_objs_hndl).bg_object[7]._3dPt_BG[7].z_point < 0)
{
if(doPers && !debugPers)
{
for(j = 0;j <= 7;j++) /* j is point in the object */
{ /* 0••7 cause 8 points in a cube or column */
preplot8[j][0] = (**w_objs_hndl).bg_object[7]._3dPt_BG[j].x_point -offset.h;
preplot8[j][1] = (**w_objs_hndl).bg_object[7]._3dPt_BG[j].y_point -offset.v;
preplot8[j][2] = (**w_objs_hndl).bg_object[7]._3dPt_BG[j].z_point;
preplot8[j][3] = (**w_objs_hndl).bg_object[7]._3dPt_BG[j].no_point;
}
/* transform to relative VRP */
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
xForm8[j][k] = 0.0;
}
}
VRPxform[0][3] = -1.0 * xVan;
VRPxform[1][3] = -1.0 * yVan;
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm8[j][k] += VRPxform[k][i] * preplot8[j][i];
}
}
}
/* first create and initialize persMat */
for(j = 0;j <= 7;j++) /* Create the translation matrices */
{
for(k = 0;k <= 3;k++)
{
for(m = 0;m <= 3;m++)
{
if(m == k) pers8Mat[j][k][m] = 1;
else pers8Mat[j][k][m] = 0;
}
}
}
for(j = 0;j <= 7;j++) /* cause eight vertices in the object */
{
Wtemp8[j] = (xForm8[j][2]) / zScale; /* tenth try */
}
for(m = 0;m <= 7;m++)
{
for(k = 0;k <= 2;k++)
{
newPers8Vect[m][k] = 0;
}
newPers8Vect[m][3] = 1;
}
for(m = 0;m <= 7;m++) // which vertex
{
/* *---------------- vertice point */
/* | *------------- row */
for(k = 0;k <= 2;k++) /* | | *-- vertice point */
{ /* v v v */
newPers8Vect[m][k] = xForm8[m][k]/(Wtemp8[m]);
}
}
/* transform back from VRP */
VRPxform[0][3] = xVan;
VRPxform[1][3] = yVan;
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
xForm8[j][k] = 0;
}
}
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm8[j][k] += VRPxform[k][i] * newPers8Vect[j][i];
}
}
}
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
newPers8Vect[j][k] = xForm8[j][k];
}
}
MoveTo(newPers8Vect[0][0],newPers8Vect[0][1]); /* second cube */
thePoly = OpenPoly();
LineTo(newPers8Vect[1][0],newPers8Vect[1][1]);
LineTo(newPers8Vect[2][0],newPers8Vect[2][1]);
LineTo(newPers8Vect[3][0],newPers8Vect[3][1]);
LineTo(newPers8Vect[0][0],newPers8Vect[0][1]);
ClosePoly();
FillPoly( thePoly,&qd.gray);
LineTo(newPers8Vect[4][0],newPers8Vect[4][1]);
thePoly = OpenPoly();
LineTo(newPers8Vect[5][0],newPers8Vect[5][1]);
LineTo(newPers8Vect[6][0],newPers8Vect[6][1]);
LineTo(newPers8Vect[7][0],newPers8Vect[7][1]);
LineTo(newPers8Vect[4][0],newPers8Vect[4][1]);
ClosePoly();
FillPoly( thePoly,&qd.black);
MoveTo(newPers8Vect[1][0],newPers8Vect[1][1]);
LineTo(newPers8Vect[5][0],newPers8Vect[5][1]);
MoveTo(newPers8Vect[2][0],newPers8Vect[2][1]);
LineTo(newPers8Vect[6][0],newPers8Vect[6][1]);
MoveTo(newPers8Vect[3][0],newPers8Vect[3][1]);
LineTo(newPers8Vect[7][0],newPers8Vect[7][1]);
}
else if (!noShow) // if(!debugPers)
{
MoveTo((**w_objs_hndl).bg_object[7]._3dPt_BG[0].x_point -offset.h, /* second cube */
(**w_objs_hndl).bg_object[7]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[7]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[7]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[7]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[7]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[7]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[7]._3dPt_BG[3].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[7]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[7]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[7]._3dPt_BG[4].x_point -offset.h,
(**w_objs_hndl).bg_object[7]._3dPt_BG[4].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[7]._3dPt_BG[5].x_point -offset.h,
(**w_objs_hndl).bg_object[7]._3dPt_BG[5].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[7]._3dPt_BG[6].x_point -offset.h,
(**w_objs_hndl).bg_object[7]._3dPt_BG[6].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[7]._3dPt_BG[7].x_point -offset.h,
(**w_objs_hndl).bg_object[7]._3dPt_BG[7].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[7]._3dPt_BG[4].x_point -offset.h,
(**w_objs_hndl).bg_object[7]._3dPt_BG[4].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[7]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[7]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[7]._3dPt_BG[5].x_point -offset.h,
(**w_objs_hndl).bg_object[7]._3dPt_BG[5].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[7]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[7]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[7]._3dPt_BG[6].x_point -offset.h,
(**w_objs_hndl).bg_object[7]._3dPt_BG[6].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[7]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[7]._3dPt_BG[3].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[7]._3dPt_BG[7].x_point -offset.h,
(**w_objs_hndl).bg_object[7]._3dPt_BG[7].y_point -offset.v);
}
}
if( (**w_objs_hndl).bg_object[8]._3dPt_BG[0].z_point < 0 && /* third cube */
(**w_objs_hndl).bg_object[8]._3dPt_BG[1].z_point < 0 &&
(**w_objs_hndl).bg_object[8]._3dPt_BG[2].z_point < 0 &&
(**w_objs_hndl).bg_object[8]._3dPt_BG[3].z_point < 0 &&
(**w_objs_hndl).bg_object[8]._3dPt_BG[4].z_point < 0 &&
(**w_objs_hndl).bg_object[8]._3dPt_BG[5].z_point < 0 &&
(**w_objs_hndl).bg_object[8]._3dPt_BG[6].z_point < 0 &&
(**w_objs_hndl).bg_object[8]._3dPt_BG[7].z_point < 0)
{
if(doPers && !debugPers)
{
for(j = 0;j <= 7;j++) /* j is point in the object */
{ /* 0••7 cause 8 points in a cube or column */
preplot8[j][0] = (**w_objs_hndl).bg_object[8]._3dPt_BG[j].x_point -offset.h;
preplot8[j][1] = (**w_objs_hndl).bg_object[8]._3dPt_BG[j].y_point -offset.v;
preplot8[j][2] = (**w_objs_hndl).bg_object[8]._3dPt_BG[j].z_point;
preplot8[j][3] = (**w_objs_hndl).bg_object[8]._3dPt_BG[j].no_point;
}
/* transform to relative VRP */
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
xForm8[j][k] = 0.0;
}
}
VRPxform[0][3] = -1.0 * xVan;
VRPxform[1][3] = -1.0 * yVan;
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm8[j][k] += VRPxform[k][i] * preplot8[j][i];
}
}
}
/* first create and initialize persMat */
for(j = 0;j <= 7;j++) /* Create the translation matrices */
{
for(k = 0;k <= 3;k++)
{
for(m = 0;m <= 3;m++)
{
if(m == k) pers8Mat[j][k][m] = 1;
else pers8Mat[j][k][m] = 0;
}
}
}
for(j = 0;j <= 7;j++) /* cause eight vertices in the object */
{
Wtemp8[j] = (xForm8[j][2]) / zScale; /* tenth try */
}
for(m = 0;m <= 7;m++)
{
for(k = 0;k <= 2;k++)
{
newPers8Vect[m][k] = 0;
}
newPers8Vect[m][3] = 1;
}
for(m = 0;m <= 7;m++) // which vertex
{
/* *---------------- vertice point */
/* | *------------- row */
for(k = 0;k <= 2;k++) /* | | *-- vertice point */
{ /* v v v */
newPers8Vect[m][k] = xForm8[m][k]/(Wtemp8[m]);
}
}
/* transform back from VRP */
VRPxform[0][3] = xVan;
VRPxform[1][3] = yVan;
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
xForm8[j][k] = 0;
}
}
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm8[j][k] += VRPxform[k][i] * newPers8Vect[j][i];
}
}
}
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
newPers8Vect[j][k] = xForm8[j][k];
}
}
MoveTo(newPers8Vect[0][0],newPers8Vect[0][1]); /* third cube */
thePoly = OpenPoly();
LineTo(newPers8Vect[1][0],newPers8Vect[1][1]);
LineTo(newPers8Vect[2][0],newPers8Vect[2][1]);
LineTo(newPers8Vect[3][0],newPers8Vect[3][1]);
LineTo(newPers8Vect[0][0],newPers8Vect[0][1]);
ClosePoly();
FillPoly( thePoly,&qd.black);
thePoly = OpenPoly();
LineTo(newPers8Vect[4][0],newPers8Vect[4][1]);
LineTo(newPers8Vect[7][0],newPers8Vect[7][1]);
LineTo(newPers8Vect[3][0],newPers8Vect[3][1]);
LineTo(newPers8Vect[0][0],newPers8Vect[0][1]);
ClosePoly();
FillPoly( thePoly,&qd.gray);
MoveTo(newPers8Vect[1][0],newPers8Vect[1][1]);
thePoly = OpenPoly();
LineTo(newPers8Vect[5][0],newPers8Vect[5][1]);
LineTo(newPers8Vect[6][0],newPers8Vect[6][1]);
LineTo(newPers8Vect[2][0],newPers8Vect[2][1]);
LineTo(newPers8Vect[1][0],newPers8Vect[1][1]);
ClosePoly();
FillPoly( thePoly,&qd.black);
MoveTo(newPers8Vect[4][0],newPers8Vect[4][1]);
LineTo(newPers8Vect[5][0],newPers8Vect[5][1]);
MoveTo(newPers8Vect[6][0],newPers8Vect[6][1]);
LineTo(newPers8Vect[7][0],newPers8Vect[7][1]);
/* LineTo(newPers8Vect[4][0],newPers8Vect[4][1]);
LineTo(newPers8Vect[5][0],newPers8Vect[5][1]);
LineTo(newPers8Vect[6][0],newPers8Vect[6][1]);
LineTo(newPers8Vect[7][0],newPers8Vect[7][1]);
LineTo(newPers8Vect[4][0],newPers8Vect[4][1]);
MoveTo(newPers8Vect[1][0],newPers8Vect[1][1]);
LineTo(newPers8Vect[5][0],newPers8Vect[5][1]);
MoveTo(newPers8Vect[2][0],newPers8Vect[2][1]);
LineTo(newPers8Vect[6][0],newPers8Vect[6][1]);
MoveTo(newPers8Vect[3][0],newPers8Vect[3][1]);
LineTo(newPers8Vect[7][0],newPers8Vect[7][1]); */
}
else // if (!noShow) // if(!debugPers)
{
MoveTo((**w_objs_hndl).bg_object[8]._3dPt_BG[0].x_point -offset.h, /* third cube */
(**w_objs_hndl).bg_object[8]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[8]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[8]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[8]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[8]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[8]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[8]._3dPt_BG[3].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[8]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[8]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[8]._3dPt_BG[4].x_point -offset.h,
(**w_objs_hndl).bg_object[8]._3dPt_BG[4].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[8]._3dPt_BG[5].x_point -offset.h,
(**w_objs_hndl).bg_object[8]._3dPt_BG[5].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[8]._3dPt_BG[6].x_point -offset.h,
(**w_objs_hndl).bg_object[8]._3dPt_BG[6].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[8]._3dPt_BG[7].x_point -offset.h,
(**w_objs_hndl).bg_object[8]._3dPt_BG[7].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[8]._3dPt_BG[4].x_point -offset.h,
(**w_objs_hndl).bg_object[8]._3dPt_BG[4].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[8]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[8]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[8]._3dPt_BG[5].x_point -offset.h,
(**w_objs_hndl).bg_object[8]._3dPt_BG[5].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[8]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[8]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[8]._3dPt_BG[6].x_point -offset.h,
(**w_objs_hndl).bg_object[8]._3dPt_BG[6].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[8]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[8]._3dPt_BG[3].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[8]._3dPt_BG[7].x_point -offset.h,
(**w_objs_hndl).bg_object[8]._3dPt_BG[7].y_point -offset.v);
}
}
if( (**w_objs_hndl).bg_object[9]._3dPt_BG[0].z_point < 0 && /* fourth cube */
(**w_objs_hndl).bg_object[9]._3dPt_BG[1].z_point < 0 &&
(**w_objs_hndl).bg_object[9]._3dPt_BG[2].z_point < 0 &&
(**w_objs_hndl).bg_object[9]._3dPt_BG[3].z_point < 0 &&
(**w_objs_hndl).bg_object[9]._3dPt_BG[4].z_point < 0 &&
(**w_objs_hndl).bg_object[9]._3dPt_BG[5].z_point < 0 &&
(**w_objs_hndl).bg_object[9]._3dPt_BG[6].z_point < 0 &&
(**w_objs_hndl).bg_object[9]._3dPt_BG[7].z_point < 0)
{
if(doPers && !debugPers)
{
for(j = 0;j <= 7;j++) /* j is point in the object */
{ /* 0••7 cause 8 points in a cube or column */
preplot8[j][0] = (**w_objs_hndl).bg_object[9]._3dPt_BG[j].x_point -offset.h;
preplot8[j][1] = (**w_objs_hndl).bg_object[9]._3dPt_BG[j].y_point -offset.v;
preplot8[j][2] = (**w_objs_hndl).bg_object[9]._3dPt_BG[j].z_point;
preplot8[j][3] = (**w_objs_hndl).bg_object[9]._3dPt_BG[j].no_point;
}
/* transform to relative VRP */
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
xForm8[j][k] = 0.0;
}
}
VRPxform[0][3] = -1.0 * xVan;
VRPxform[1][3] = -1.0 * yVan;
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm8[j][k] += VRPxform[k][i] * preplot8[j][i];
}
}
}
/* first create and initialize persMat */
for(j = 0;j <= 7;j++) /* Create the translation matrices */
{
for(k = 0;k <= 3;k++)
{
for(m = 0;m <= 3;m++)
{
if(m == k) pers8Mat[j][k][m] = 1;
else pers8Mat[j][k][m] = 0;
}
}
}
for(j = 0;j <= 7;j++) /* cause eight vertices in the object */
{
Wtemp8[j] = (xForm8[j][2]) / zScale; /* tenth try */
}
for(m = 0;m <= 7;m++)
{
for(k = 0;k <= 2;k++)
{
newPers8Vect[m][k] = 0;
}
newPers8Vect[m][3] = 1;
}
for(m = 0;m <= 7;m++) // which vertex
{
/* *---------------- vertice point */
/* | *------------- row */
for(k = 0;k <= 2;k++) /* | | *-- vertice point */
{ /* v v v */
newPers8Vect[m][k] = xForm8[m][k]/(Wtemp8[m]);
}
}
/* transform back from VRP */
VRPxform[0][3] = xVan;
VRPxform[1][3] = yVan;
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
xForm8[j][k] = 0;
}
}
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm8[j][k] += VRPxform[k][i] * newPers8Vect[j][i];
}
}
}
for(j = 0;j <= 7;j++)
{
for(k = 0;k <= 3;k++)
{
newPers8Vect[j][k] = xForm8[j][k];
}
}
MoveTo(newPers8Vect[0][0],newPers8Vect[0][1]); /* fourth cube */
thePoly = OpenPoly();
LineTo(newPers8Vect[1][0],newPers8Vect[1][1]);
LineTo(newPers8Vect[2][0],newPers8Vect[2][1]);
LineTo(newPers8Vect[3][0],newPers8Vect[3][1]);
LineTo(newPers8Vect[0][0],newPers8Vect[0][1]);
ClosePoly();
FillPoly( thePoly,&qd.black);
LineTo(newPers8Vect[4][0],newPers8Vect[4][1]);
thePoly = OpenPoly();
LineTo(newPers8Vect[5][0],newPers8Vect[5][1]);
LineTo(newPers8Vect[6][0],newPers8Vect[6][1]);
LineTo(newPers8Vect[7][0],newPers8Vect[7][1]);
LineTo(newPers8Vect[4][0],newPers8Vect[4][1]);
ClosePoly();
FillPoly( thePoly,&qd.black);
MoveTo(newPers8Vect[1][0],newPers8Vect[1][1]);
LineTo(newPers8Vect[5][0],newPers8Vect[5][1]);
MoveTo(newPers8Vect[2][0],newPers8Vect[2][1]);
LineTo(newPers8Vect[6][0],newPers8Vect[6][1]);
MoveTo(newPers8Vect[3][0],newPers8Vect[3][1]);
LineTo(newPers8Vect[7][0],newPers8Vect[7][1]);
}
else // if (!noShow) //if(!debugPers)
{
MoveTo((**w_objs_hndl).bg_object[9]._3dPt_BG[0].x_point -offset.h, /* fourth cube */
(**w_objs_hndl).bg_object[9]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[9]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[9]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[9]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[9]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[9]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[9]._3dPt_BG[3].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[9]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[9]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[9]._3dPt_BG[4].x_point -offset.h,
(**w_objs_hndl).bg_object[9]._3dPt_BG[4].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[9]._3dPt_BG[5].x_point -offset.h,
(**w_objs_hndl).bg_object[9]._3dPt_BG[5].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[9]._3dPt_BG[6].x_point -offset.h,
(**w_objs_hndl).bg_object[9]._3dPt_BG[6].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[9]._3dPt_BG[7].x_point -offset.h,
(**w_objs_hndl).bg_object[9]._3dPt_BG[7].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[9]._3dPt_BG[4].x_point -offset.h,
(**w_objs_hndl).bg_object[9]._3dPt_BG[4].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[9]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[9]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[9]._3dPt_BG[5].x_point -offset.h,
(**w_objs_hndl).bg_object[9]._3dPt_BG[5].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[9]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[9]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[9]._3dPt_BG[6].x_point -offset.h,
(**w_objs_hndl).bg_object[9]._3dPt_BG[6].y_point -offset.v);
MoveTo((**w_objs_hndl).bg_object[9]._3dPt_BG[3].x_point -offset.h,
(**w_objs_hndl).bg_object[9]._3dPt_BG[3].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[9]._3dPt_BG[7].x_point -offset.h,
(**w_objs_hndl).bg_object[9]._3dPt_BG[7].y_point -offset.v);
} /* end of fourth cube */
}
if( (**w_objs_hndl).bg_object[10]._3dPt_BG[0].z_point < 0 &&
(**w_objs_hndl).bg_object[10]._3dPt_BG[1].z_point < 0 &&
(**w_objs_hndl).bg_object[10]._3dPt_BG[2].z_point < 0)
{
if(doPers)
{
for(j = 0;j <= 2;j++) /* 0••2 cause 3 points for a triangle */
{
preplot3[j][0] = (**w_objs_hndl).bg_object[10]._3dPt_BG[j].x_point -offset.h;
preplot3[j][1] = (**w_objs_hndl).bg_object[10]._3dPt_BG[j].y_point -offset.v;
preplot3[j][2] = (**w_objs_hndl).bg_object[10]._3dPt_BG[j].z_point;
preplot3[j][3] = (**w_objs_hndl).bg_object[10]._3dPt_BG[j].no_point;
}
/* transform to relative VRP */
for(j = 0;j <= 2;j++) /* initialize xForm3 */
{
for(k = 0;k <= 3;k++)
{
xForm3[j][k] = 0.0;
}
}
/* set VRP */
VRPxform[0][3] = -1.0 * xVan;
VRPxform[1][3] = -1.0 * yVan;
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm3[j][k] += VRPxform[k][i] * preplot3[j][i];
}
}
} /* first create persMat */
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
for(m = 0;m <= 3;m++)
{
if(m == k) pers3Mat[j][k][m] = 1;
else pers3Mat[j][k][m] = 0;
}
}
}
for(j = 0;j <= 2;j++) /* cause three vertices in the object */
{
Wtemp3[j] = (xForm3[j][2]) / zScale; /* tenth try */
}
for(m = 0;m <= 2;m++)
{
for(k = 0;k <= 2;k++)
{
newPers3Vect[m][k] = 0;
}
newPers3Vect[m][3] = 1;
}
for(m = 0;m <= 2;m++) /* *-------------- vertice point */
{ /* | *----------- column */
for(k = 0;k <= 2;k++) /* | | *-------- vertice point */
{ /* v v v */
newPers3Vect[m][k] = xForm3[m][k]/(Wtemp3[m]);
}
}
/* transform back from VRP */
VRPxform[0][3] = xVan;
VRPxform[1][3] = yVan;
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
xForm3[j][k] = 0;
}
}
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm3[j][k] += VRPxform[k][i] * newPers3Vect[j][i];
}
}
}
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
newPers3Vect[j][k] = xForm3[j][k];
}
}
MoveTo(newPers3Vect[0][0],newPers3Vect[0][1]);
LineTo(newPers3Vect[1][0],newPers3Vect[1][1]);
LineTo(newPers3Vect[2][0],newPers3Vect[2][1]);
LineTo(newPers3Vect[0][0],newPers3Vect[0][1]);
}
else if (!noShow)
{ /* first triangle */
MoveTo((**w_objs_hndl).bg_object[10]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[10]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[10]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[10]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[10]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[10]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[10]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[10]._3dPt_BG[0].y_point -offset.v);
}
}
if( (**w_objs_hndl).bg_object[11]._3dPt_BG[0].z_point < 0 &&
(**w_objs_hndl).bg_object[11]._3dPt_BG[1].z_point < 0 &&
(**w_objs_hndl).bg_object[11]._3dPt_BG[2].z_point < 0)
{
if(doPers)
{
for(j = 0;j <= 2;j++) /* 0••2 cause 3 points for a triangle */
{
preplot3[j][0] = (**w_objs_hndl).bg_object[11]._3dPt_BG[j].x_point -offset.h;
preplot3[j][1] = (**w_objs_hndl).bg_object[11]._3dPt_BG[j].y_point -offset.v;
preplot3[j][2] = (**w_objs_hndl).bg_object[11]._3dPt_BG[j].z_point;
preplot3[j][3] = (**w_objs_hndl).bg_object[11]._3dPt_BG[j].no_point;
}
/* transform to relative VRP */
for(j = 0;j <= 2;j++) /* initialize xForm3 */
{
for(k = 0;k <= 3;k++)
{
xForm3[j][k] = 0.0;
}
}
/* set VRP */
VRPxform[0][3] = -1.0 * xVan;
VRPxform[1][3] = -1.0 * yVan;
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm3[j][k] += VRPxform[k][i] * preplot3[j][i];
}
}
} /* first create persMat */
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
for(m = 0;m <= 3;m++)
{
if(m == k) pers3Mat[j][k][m] = 1;
else pers3Mat[j][k][m] = 0;
}
}
}
for(j = 0;j <= 2;j++) /* cause three vertices in the object */
{
Wtemp3[j] = (xForm3[j][2]) / zScale; /* tenth try */
}
for(m = 0;m <= 2;m++)
{
for(k = 0;k <= 2;k++)
{
newPers3Vect[m][k] = 0;
}
newPers3Vect[m][3] = 1;
}
for(m = 0;m <= 2;m++) /* *-------------- vertice point */
{ /* | *----------- column */
for(k = 0;k <= 2;k++) /* | | *-------- vertice point */
{ /* v v v */
newPers3Vect[m][k] = xForm3[m][k]/(Wtemp3[m]);
}
}
/* transform back from VRP */
VRPxform[0][3] = xVan;
VRPxform[1][3] = yVan;
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
xForm3[j][k] = 0;
}
}
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm3[j][k] += VRPxform[k][i] * newPers3Vect[j][i];
}
}
}
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
newPers3Vect[j][k] = xForm3[j][k];
}
}
MoveTo(newPers3Vect[0][0],newPers3Vect[0][1]);
thePoly = OpenPoly();
LineTo(newPers3Vect[1][0],newPers3Vect[1][1]);
LineTo(newPers3Vect[2][0],newPers3Vect[2][1]);
LineTo(newPers3Vect[0][0],newPers3Vect[0][1]);
ClosePoly();
FillPoly( thePoly,&qd.black);
}
else if (!noShow)
{ /* second triangle */
MoveTo((**w_objs_hndl).bg_object[11]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[11]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[11]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[11]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[11]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[11]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[11]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[11]._3dPt_BG[0].y_point -offset.v);
}
}
if( (**w_objs_hndl).bg_object[12]._3dPt_BG[0].z_point < 0 &&
(**w_objs_hndl).bg_object[12]._3dPt_BG[1].z_point < 0 &&
(**w_objs_hndl).bg_object[12]._3dPt_BG[2].z_point < 0)
{
if(doPers)
{
for(j = 0;j <= 2;j++) /* 0••2 cause 3 points for a triangle */
{
preplot3[j][0] = (**w_objs_hndl).bg_object[12]._3dPt_BG[j].x_point -offset.h;
preplot3[j][1] = (**w_objs_hndl).bg_object[12]._3dPt_BG[j].y_point -offset.v;
preplot3[j][2] = (**w_objs_hndl).bg_object[12]._3dPt_BG[j].z_point;
preplot3[j][3] = (**w_objs_hndl).bg_object[12]._3dPt_BG[j].no_point;
}
/* transform to relative VRP */
for(j = 0;j <= 2;j++) /* initialize xForm3 */
{
for(k = 0;k <= 3;k++)
{
xForm3[j][k] = 0.0;
}
}
/* set VRP */
VRPxform[0][3] = -1.0 * xVan;
VRPxform[1][3] = -1.0 * yVan;
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm3[j][k] += VRPxform[k][i] * preplot3[j][i];
}
}
} /* first create persMat */
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
for(m = 0;m <= 3;m++)
{
if(m == k) pers3Mat[j][k][m] = 1;
else pers3Mat[j][k][m] = 0;
}
}
}
for(j = 0;j <= 2;j++) /* cause three vertices in the object */
{
Wtemp3[j] = (xForm3[j][2]) / zScale; /* tenth try */
}
for(m = 0;m <= 2;m++)
{
for(k = 0;k <= 2;k++)
{
newPers3Vect[m][k] = 0;
}
newPers3Vect[m][3] = 1;
}
for(m = 0;m <= 2;m++) /* *-------------- vertice point */
{ /* | *----------- column */
for(k = 0;k <= 2;k++) /* | | *-------- vertice point */
{ /* v v v */
newPers3Vect[m][k] = xForm3[m][k]/(Wtemp3[m]);
}
}
/* transform back from VRP */
VRPxform[0][3] = xVan;
VRPxform[1][3] = yVan;
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
xForm3[j][k] = 0;
}
}
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm3[j][k] += VRPxform[k][i] * newPers3Vect[j][i];
}
}
}
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
newPers3Vect[j][k] = xForm3[j][k];
}
}
MoveTo(newPers3Vect[0][0],newPers3Vect[0][1]);
thePoly = OpenPoly();
LineTo(newPers3Vect[1][0],newPers3Vect[1][1]);
LineTo(newPers3Vect[2][0],newPers3Vect[2][1]);
LineTo(newPers3Vect[0][0],newPers3Vect[0][1]);
ClosePoly();
FillPoly( thePoly,&qd.gray);
}
else
{ /* third triangle */
MoveTo((**w_objs_hndl).bg_object[12]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[12]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[12]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[12]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[12]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[12]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[12]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[12]._3dPt_BG[0].y_point -offset.v);
}
}
if( (**w_objs_hndl).bg_object[13]._3dPt_BG[0].z_point < 0 &&
(**w_objs_hndl).bg_object[13]._3dPt_BG[1].z_point < 0 &&
(**w_objs_hndl).bg_object[13]._3dPt_BG[2].z_point < 0)
{
if(doPers)
{
for(j = 0;j <= 2;j++) /* 0••2 cause 3 points for a triangle */
{
preplot3[j][0] = (**w_objs_hndl).bg_object[13]._3dPt_BG[j].x_point -offset.h;
preplot3[j][1] = (**w_objs_hndl).bg_object[13]._3dPt_BG[j].y_point -offset.v;
preplot3[j][2] = (**w_objs_hndl).bg_object[13]._3dPt_BG[j].z_point;
preplot3[j][3] = (**w_objs_hndl).bg_object[13]._3dPt_BG[j].no_point;
}
/* transform to relative VRP */
for(j = 0;j <= 2;j++) /* initialize xForm3 */
{
for(k = 0;k <= 3;k++)
{
xForm3[j][k] = 0.0;
}
}
/* set VRP */
VRPxform[0][3] = -1.0 * xVan;
VRPxform[1][3] = -1.0 * yVan;
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm3[j][k] += VRPxform[k][i] * preplot3[j][i];
}
}
} /* first create persMat */
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
for(m = 0;m <= 3;m++)
{
if(m == k) pers3Mat[j][k][m] = 1;
else pers3Mat[j][k][m] = 0;
}
}
}
for(j = 0;j <= 2;j++) /* cause three vertices in the object */
{
Wtemp3[j] = (xForm3[j][2]) / zScale; /* tenth try */
}
for(m = 0;m <= 2;m++)
{
for(k = 0;k <= 2;k++)
{
newPers3Vect[m][k] = 0;
}
newPers3Vect[m][3] = 1;
}
for(m = 0;m <= 2;m++) /* *-------------- vertice point */
{ /* | *----------- column */
for(k = 0;k <= 2;k++) /* | | *-------- vertice point */
{ /* v v v */
newPers3Vect[m][k] = xForm3[m][k]/(Wtemp3[m]);
}
}
/* transform back from VRP */
VRPxform[0][3] = xVan;
VRPxform[1][3] = yVan;
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
xForm3[j][k] = 0;
}
}
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm3[j][k] += VRPxform[k][i] * newPers3Vect[j][i];
}
}
}
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
newPers3Vect[j][k] = xForm3[j][k];
}
}
MoveTo(newPers3Vect[0][0],newPers3Vect[0][1]);
thePoly = OpenPoly();
LineTo(newPers3Vect[1][0],newPers3Vect[1][1]);
LineTo(newPers3Vect[2][0],newPers3Vect[2][1]);
LineTo(newPers3Vect[0][0],newPers3Vect[0][1]);
ClosePoly();
FillPoly( thePoly,&qd.gray);
}
else
{ /* fourth triangle */
MoveTo((**w_objs_hndl).bg_object[13]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[13]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[13]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[13]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[13]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[13]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[13]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[13]._3dPt_BG[0].y_point -offset.v);
}
}
if( (**w_objs_hndl).bg_object[14]._3dPt_BG[0].z_point < 0 &&
(**w_objs_hndl).bg_object[14]._3dPt_BG[1].z_point < 0 &&
(**w_objs_hndl).bg_object[14]._3dPt_BG[2].z_point < 0)
{
if(doPers && !debugPers)
{
for(j = 0;j <= 2;j++) /* 0••2 cause 3 points for a triangle */
{
preplot3[j][0] = (**w_objs_hndl).bg_object[14]._3dPt_BG[j].x_point -offset.h;
preplot3[j][1] = (**w_objs_hndl).bg_object[14]._3dPt_BG[j].y_point -offset.v;
preplot3[j][2] = (**w_objs_hndl).bg_object[14]._3dPt_BG[j].z_point;
preplot3[j][3] = (**w_objs_hndl).bg_object[14]._3dPt_BG[j].no_point;
}
/* transform to relative VRP */
for(j = 0;j <= 2;j++) /* initialize xForm3 */
{
for(k = 0;k <= 3;k++)
{
xForm3[j][k] = 0.0;
}
}
/* set VRP */
VRPxform[0][3] = -1.0 * xVan;
VRPxform[1][3] = -1.0 * yVan;
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm3[j][k] += VRPxform[k][i] * preplot3[j][i];
}
}
} /* first create persMat */
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
for(m = 0;m <= 3;m++)
{
if(m == k) pers3Mat[j][k][m] = 1;
else pers3Mat[j][k][m] = 0;
}
}
}
for(j = 0;j <= 2;j++) /* cause three vertices in the object */
{
Wtemp3[j] = (xForm3[j][2]) / zScale; /* tenth try */
}
for(m = 0;m <= 2;m++)
{
for(k = 0;k <= 2;k++)
{
newPers3Vect[m][k] = 0;
}
newPers3Vect[m][3] = 1;
}
for(m = 0;m <= 2;m++) /* *-------------- vertice point */
{ /* | *----------- column */
for(k = 0;k <= 2;k++) /* | | *-------- vertice point */
{ /* v v v */
newPers3Vect[m][k] = xForm3[m][k]/(Wtemp3[m]);
}
}
/* transform back from VRP */
VRPxform[0][3] = xVan;
VRPxform[1][3] = yVan;
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
xForm3[j][k] = 0;
}
}
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm3[j][k] += VRPxform[k][i] * newPers3Vect[j][i];
}
}
}
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
newPers3Vect[j][k] = xForm3[j][k];
}
}
MoveTo(newPers3Vect[0][0],newPers3Vect[0][1]);
thePoly = OpenPoly();
LineTo(newPers3Vect[1][0],newPers3Vect[1][1]);
LineTo(newPers3Vect[2][0],newPers3Vect[2][1]);
LineTo(newPers3Vect[0][0],newPers3Vect[0][1]);
ClosePoly();
FillPoly( thePoly,&qd.black);
}
else
{ /* fifth triangle */
MoveTo((**w_objs_hndl).bg_object[14]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[14]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[14]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[14]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[14]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[14]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[14]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[14]._3dPt_BG[0].y_point -offset.v);
}
}
if( (**w_objs_hndl).bg_object[15]._3dPt_BG[0].z_point < 0 &&
(**w_objs_hndl).bg_object[15]._3dPt_BG[1].z_point < 0 &&
(**w_objs_hndl).bg_object[15]._3dPt_BG[2].z_point < 0)
{
if(doPers)
{
for(j = 0;j <= 2;j++) /* 0••2 cause 3 points for a triangle */
{
preplot3[j][0] = (**w_objs_hndl).bg_object[15]._3dPt_BG[j].x_point -offset.h;
preplot3[j][1] = (**w_objs_hndl).bg_object[15]._3dPt_BG[j].y_point -offset.v;
preplot3[j][2] = (**w_objs_hndl).bg_object[15]._3dPt_BG[j].z_point;
preplot3[j][3] = (**w_objs_hndl).bg_object[15]._3dPt_BG[j].no_point;
}
/* transform to relative VRP */
for(j = 0;j <= 2;j++) /* initialize xForm3 */
{
for(k = 0;k <= 3;k++)
{
xForm3[j][k] = 0.0;
}
}
/* set VRP */
VRPxform[0][3] = -1.0 * xVan;
VRPxform[1][3] = -1.0 * yVan;
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm3[j][k] += VRPxform[k][i] * preplot3[j][i];
}
}
} /* first create persMat */
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
for(m = 0;m <= 3;m++)
{
if(m == k) pers3Mat[j][k][m] = 1;
else pers3Mat[j][k][m] = 0;
}
}
}
for(j = 0;j <= 2;j++) /* cause three vertices in the object */
{
Wtemp3[j] = (xForm3[j][2]) / zScale; /* tenth try */
}
for(m = 0;m <= 2;m++)
{
for(k = 0;k <= 2;k++)
{
newPers3Vect[m][k] = 0;
}
newPers3Vect[m][3] = 1;
}
for(m = 0;m <= 2;m++) /* *-------------- vertice point */
{ /* | *----------- column */
for(k = 0;k <= 2;k++) /* | | *-------- vertice point */
{ /* v v v */
newPers3Vect[m][k] = xForm3[m][k]/(Wtemp3[m]);
}
}
/* transform back from VRP */
VRPxform[0][3] = xVan;
VRPxform[1][3] = yVan;
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
xForm3[j][k] = 0;
}
}
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
for(i = 0;i <= 3;i++)
{
xForm3[j][k] += VRPxform[k][i] * newPers3Vect[j][i];
}
}
}
for(j = 0;j <= 2;j++)
{
for(k = 0;k <= 3;k++)
{
newPers3Vect[j][k] = xForm3[j][k];
}
}
MoveTo(newPers3Vect[0][0],newPers3Vect[0][1]);
thePoly = OpenPoly();
LineTo(newPers3Vect[1][0],newPers3Vect[1][1]);
LineTo(newPers3Vect[2][0],newPers3Vect[2][1]);
LineTo(newPers3Vect[0][0],newPers3Vect[0][1]);
ClosePoly();
FillPoly( thePoly,&qd.gray);
}
else
{ /* sixth triangle */
MoveTo((**w_objs_hndl).bg_object[15]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[15]._3dPt_BG[0].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[15]._3dPt_BG[1].x_point -offset.h,
(**w_objs_hndl).bg_object[15]._3dPt_BG[1].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[15]._3dPt_BG[2].x_point -offset.h,
(**w_objs_hndl).bg_object[15]._3dPt_BG[2].y_point -offset.v);
LineTo((**w_objs_hndl).bg_object[15]._3dPt_BG[0].x_point -offset.h,
(**w_objs_hndl).bg_object[15]._3dPt_BG[0].y_point -offset.v);
}
}
if(obj_type == T_BACKGRND_OBJ)
{
if( (**w_objs_hndl).bg_object[16]._3dPt_BG[0].z_point < 0 && (**w_objs_hndl).bg_object[16].alive)
{
_left = (**w_objs_hndl).bg_object[16]._3dPt_BG[0].x_point;
_top = (**w_objs_hndl).bg_object[16]._3dPt_BG[0].y_point;
_right = _left + 32;
_bottom = _top + 32;
SetRect(&gFirstCalcIcon,_left,_top,_right,_bottom);
icon_hndl = GetResource('ICON', FIRST_CALC_ID);
PlotIcon(&gFirstCalcIcon, icon_hndl);
}
if( (**w_objs_hndl).bg_object[17]._3dPt_BG[0].z_point < 0 && (**w_objs_hndl).bg_object[17].alive)
{
_left = (**w_objs_hndl).bg_object[17]._3dPt_BG[0].x_point;
_top = (**w_objs_hndl).bg_object[17]._3dPt_BG[0].y_point;
_right = _left + 32;
_bottom = _top + 32;
SetRect(&gSecondCalcIcon,_left,_top,_right,_bottom);
icon_hndl = GetResource('ICON', SECOND_CALC_ID);
PlotIcon(&gSecondCalcIcon, icon_hndl);
}
if( (**w_objs_hndl).bg_object[18]._3dPt_BG[0].z_point < 0 && (**w_objs_hndl).bg_object[18].alive)
{
_left = (**w_objs_hndl).bg_object[18]._3dPt_BG[0].x_point;
_top = (**w_objs_hndl).bg_object[18]._3dPt_BG[0].y_point;
_right = _left + 32;
_bottom = _top + 32;
SetRect(&gThirdCalcIcon,_left,_top,_right,_bottom);
icon_hndl = GetResource('ICON', THIRD_CALC_ID);
PlotIcon(&gThirdCalcIcon, icon_hndl);
}
if( (**w_objs_hndl).bg_object[19]._3dPt_BG[0].z_point < 0 && (**w_objs_hndl).bg_object[19].alive)
{
_left = (**w_objs_hndl).bg_object[19]._3dPt_BG[0].x_point;
_top = (**w_objs_hndl).bg_object[19]._3dPt_BG[0].y_point;
_right = _left + 32;
_bottom = _top + 32;
SetRect(&gFourthCalcIcon,_left,_top,_right,_bottom);
icon_hndl = GetResource('ICON', FOURTH_CALC_ID);
PlotIcon(&gFourthCalcIcon, icon_hndl);
}
if( (**w_objs_hndl).bg_object[20]._3dPt_BG[0].z_point < 0 && (**w_objs_hndl).bg_object[20].alive)
{
_left = (**w_objs_hndl).bg_object[20]._3dPt_BG[0].x_point;
_top = (**w_objs_hndl).bg_object[20]._3dPt_BG[0].y_point;
_right = _left + 32;
_bottom = _top + 32;
SetRect(&gFifthCalcIcon,_left,_top,_right,_bottom);
icon_hndl = GetResource('ICON', FIFTH_CALC_ID);
PlotIcon(&gFifthCalcIcon, icon_hndl);
}
if( (**w_objs_hndl).bg_object[21]._3dPt_BG[0].z_point < 0 && (**w_objs_hndl).bg_object[21].alive)
{
_left = (**w_objs_hndl).bg_object[21]._3dPt_BG[0].x_point;
_top = (**w_objs_hndl).bg_object[21]._3dPt_BG[0].y_point;
_right = _left + 32;
_bottom = _top + 32;
SetRect(&gSixthCalcIcon,_left,_top,_right,_bottom);
icon_hndl = GetResource('ICON', SIXTH_CALC_ID);
PlotIcon(&gSixthCalcIcon, icon_hndl);
}
}
}
SetPort( oldPort ); /* can set breakpoint here */
} /* end of draw_object() **/